using ASP;
using System;
using System.Configuration;
using System.Data.Common;
using System.Data.SqlClient;
using System.Globalization;
using System.Threading;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

public partial class FilterProjectGroup : Page, IRequiresSessionState
{
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        this.gvwProjectGroup.DataBind();
    }

    protected void gvwProjectGroup_SelectedIndexChanged(object sender, EventArgs e)
    {
        string Result = this.gvwProjectGroup.DataKeys[this.gvwProjectGroup.SelectedIndex]["ProjectGroupID"].ToString();
        if (this.Session["SelectedProjectGroup"] != null)
        {
            this.Session["SelectedProjectGroup"] = Result;
        }
        else
        {
            this.Session.Add("SelectedProjectGroup", Result);
        }
        string scriptStr = "<script>window.close();</script>";
        base.ClientScript.RegisterClientScriptBlock(typeof(string), "closing", scriptStr);
    }

    protected override void InitializeCulture()
    {
        string sCulture = ConfigurationManager.AppSettings["DefaultCulture"].ToString();
        try
        {
            sCulture = this.Session["Culture"].ToString();
        }
        catch (NullReferenceException)
        {
        }
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(sCulture);
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(sCulture);
        base.InitializeCulture();
    }

    protected void ODSProjectGroup_Selecting1(object sender, ObjectDataSourceSelectingEventArgs e)
    {
        SqlParameter[] sqlparam = new SqlParameter[] { new SqlParameter() };
        sqlparam[0].ParameterName = "@ProjectGroupID";
        sqlparam[0].Value = this.txtProjectGroup.Text;
        DbParameter[] param = sqlparam;
        e.InputParameters[0] = "_IPMS_ProjectGroupSearch_Sp";
        e.InputParameters[1] = param;
    }
}
